FROM java:8 as builder

WORKDIR /app

COPY . .

RUN ./gradlew build -x test

FROM  java:8

LABEL MAINTAINER="gaoge"

ENV TZ Asia/Shanghai
ENV TIME_ZONE=Asia/Shanghai
RUN ln -snf /usr/share/zoneinfo/$TIME_ZONE /etc/localtime && echo $TIME_ZONE > /etc/timezone
ENV SERVER_PORT 9527
ENV SERVER_ADDR 0.0.0.0:$SERVER_PORT

WORKDIR /opt/lcuiot

COPY --from=builder /app/build/libs/*SNAPSHOT.jar ./
COPY start.sh ./
RUN chmod +x /opt/lcuiot/start.sh

EXPOSE $SERVER_PORT
ENTRYPOINT ["sh","/opt/lcuiot/start.sh"]





